package com.itheima.d1_collection_set;

import java.util.HashSet;

/*
     目标：自定义的类型的对象，比如两个内容一样的学生对象，如果让HashSet集合能够去重复！
 */
public class SetTest3 {
    public static void main(String[] args) {
        HashSet<Student> set = new HashSet<>();
        set.add(new Student("张三",33));
        set.add(new Student("李四",37));
        set.add(new Student("王五",22));
        set.add(new Student("赵六",66));
        set.add(new Student("张三",33));

        for (Student s : set) {
            System.out.println(s.getName() +" " + s.getAge());
        }
    }
}
